import {getCompanyList} from './api';
export const formItems = [
  {
    label: '轮播图ID',
    name: 'id',
    type: 'input-number',
    itemProps: {
      style: {width: '100%'}
    }
  },
  {
    label: '标题',
    name: 'title',
    type: 'input',
  },
  {
    label: '所属企业',
    name: 'company_id',
    type: 'select',
    asyncOptions: {
      api: getCompanyList,
      dataField: 'list',
      optionFields: {
        label: 'name',
        value: 'id',
      },
    }
  },
  {
    label: '状态',
    name: 'status',
    span: 8,
    type: 'select',
    itemProps: {
      options: [
        {
          label: '上架',
          value: 1,
        },
        {
          label: '下架',
          value: 0,
        },
      ],
    },
  },
  {
    label: '创建日期',
    name: 'create_times',
    span: 8,
    valueType: 'string',
    value: [],
    type: 'range-picker',
    format: 'YYYY-MM-DD',
  },
  {
    label: '展示日期',
    name: 'show_times',
    span: 8,
    valueType: 'string',
    value: [],
    type: 'range-picker',
    format: 'YYYY-MM-DD',
  }
];

export const searchRules = {
  searchName: [
    {
      required: true,
      message: 'Please input Activity name',
      trigger: 'blur',
    },
    {
      max: 15,
      message: 'Length should be max 15',
      trigger: 'blur',
    },
  ],
};

export const columns = [
  {
    title: '操作',
    dataIndex: 'action',
    slots: { customRender: 'action' },
    width: 200,
  },
  {
    title: '轮播图ID',
    dataIndex: 'id',
    key: 'id',
    width: 100,
  },
  {
    title: '所属企业',
    dataIndex: 'company_name',
    key: 'company_name',
    width: 200,
  },
  {
    title: '标题',
    dataIndex: 'title',
    key: 'title',
    width: 200,
  },
  {
    title: '图片',
    dataIndex: 'banner_img',
    key: 'banner_img',
    align: 'center',
    slots: { customRender: 'banner_img' },
    width: 200,
  },
  {
    title: '发布位置',
    dataIndex: 'position_name',
    key: 'position_name',
    width: 100,
  },
  {
    title: '显示顺序',
    dataIndex: 'sort',
    key: 'sort',
    width: 100,
  },
  {
    title: '创建时间',
    dataIndex: 'create_time_s',
    key: 'create_time_s',
    width: 200,
  },
  {
    title: '展示开始时间',
    dataIndex: 'start_at_s',
    key: 'start_at_s',
    width: 200,
  },
  {
    title: '展示结束时间',
    dataIndex: 'end_at_s',
    key: 'end_at_s',
    width: 200,
  },
  {
    title: '状态',
    dataIndex: 'status_name',
    key: 'status_name',
    width: 100,
  },
];
